package com.oracle.sbdb.util;

import java.util.HashMap;
import java.util.Map;

public class OSUtil {
	private static Map<Integer, String> int2string = loadInt2String();
	private static Map<String, Integer> string2int = loadString2Int();
	
	private static Map<Integer, String> loadInt2String(){
		Map<Integer, String> res = new HashMap<Integer, String>();
		res.put(537, "Acme Packet 1100Acme Packet 1100 - 537");
		res.put(529, "Acme Packet 3820Acme Packet 3820 - 529");
		res.put(540, "Acme Packet 3900Acme Packet 3900 - 540");
		res.put(530, "Acme Packet 4500Acme Packet 4500 - 530");
		res.put(538, "Acme Packet 4600Acme Packet 4600 - 538");
		res.put(534, "Acme Packet 6100Acme Packet 6100 - 534");
		res.put(531, "Acme Packet 6300Acme Packet 6300 - 531");
		res.put(527, "Acme Packet OSAcme Packet OS - 527");
		res.put(293, "Apple Mac OS X (Intel) (32-bit)Apple Mac OS X (Intel) (32-bit) - 293");
		res.put(522, "Apple Mac OS X (Intel) (64-bit)Apple Mac OS X (Intel) (64-bit) - 522");
		res.put(421, "Apple Mac OS X (PowerPC)Apple Mac OS X (PowerPC) - 421");
		res.put(512, "Apple iOSApple iOS - 512");
		res.put(516, "Embedded Linux ARMEmbedded Linux ARM - 516");
		res.put(294, "Embedded Linux SH4Embedded Linux SH4 - 294");
		res.put(517, "Embedded Linux on POWER PCEmbedded Linux on POWER PC - 517");
		res.put(519, "Embedded Linux on POWER PC e500v2Embedded Linux on POWER PC e500v2 - 519");
		res.put(521, "Embedded Linux on cnMIPSEmbedded Linux on cnMIPS - 521");
		res.put(515, "Embedded Linux x86Embedded Linux x86 - 515");
		res.put(296, "Embedded Linux xScaleEmbedded Linux xScale - 296");
		res.put(228, "FreeBSD - x86FreeBSD - x86 - 228");
		res.put(361, "Fujitsu BS2000/OSD (S series)Fujitsu BS2000/OSD (S series) - 361");
		res.put(312, "Fujitsu BS2000/OSD (SQ series)Fujitsu BS2000/OSD (SQ series) - 312");
		res.put(285, "Fujitsu BS2000/OSD (SX series)Fujitsu BS2000/OSD (SX series) - 285");
		res.put(504, "Fujitsu MSP-EXFujitsu MSP-EX - 504");
		res.put(289, "GENERIC (All Platforms)GENERIC (All Platforms) - 289");
		res.put(513, "Google AndroidGoogle Android - 513");
		res.put(549, "HP NonStop (Guardian) on x86HP NonStop (Guardian) on x86 - 549");
		res.put(548, "HP NonStop (OSS) on x86HP NonStop (OSS) on x86 - 548");
		res.put(304, "HP NonStop Itanium (Guardian)HP NonStop Itanium (Guardian) - 304");
		res.put(308, "HP NonStop Itanium (OSS)HP NonStop Itanium (OSS) - 308");
		res.put(303, "HP NonStop S-series (Guardian)HP NonStop S-series (Guardian) - 303");
		res.put(89, "HP OpenVMS AlphaHP OpenVMS Alpha - 89");
		res.put(243, "HP OpenVMS ItaniumHP OpenVMS Itanium - 243");
		res.put(1, "HP OpenVMS VAXHP OpenVMS VAX - 1");
		res.put(87, "HP Tru64 UNIXHP Tru64 UNIX - 87");
		res.put(197, "HP-UX ItaniumHP-UX Itanium - 197");
		res.put(278, "HP-UX Itanium (32-bit)HP-UX Itanium (32-bit) - 278");
		res.put(2, "HP-UX PA-RISC (32-bit)HP-UX PA-RISC (32-bit) - 2");
		res.put(59, "HP-UX PA-RISC (64-bit)HP-UX PA-RISC (64-bit) - 59");
		res.put(319, "IBM AIX on POWER Systems (32-bit)IBM AIX on POWER Systems (32-bit) - 319");
		res.put(212, "IBM AIX on POWER Systems (64-bit)IBM AIX on POWER Systems (64-bit) - 212");
		res.put(211, "IBM S/390 Based Linux (31-bit)IBM S/390 Based Linux (31-bit) - 211");
		res.put(43, "IBM i on POWER SystemsIBM i on POWER Systems - 43");
		res.put(30, "IBM z/OS on System zIBM z/OS on System z - 30");
		res.put(314, "IBM z/VM on System zIBM z/VM on System z - 314");
		res.put(227, "IBM: Linux on POWER Big Endian SystemsIBM: Linux on POWER Big Endian Systems - 227");
		res.put(542, "IBM: Linux on POWER Little Endian SystemsIBM: Linux on POWER Little Endian Systems - 542");
		res.put(209, "IBM: Linux on System zIBM: Linux on System z - 209");
		res.put(528, "Linux ARM 32-bit VFP HardFP ABILinux ARM 32-bit VFP HardFP ABI - 528");
		res.put(523, "Linux ARM 32-bit VFP SoftFP ABILinux ARM 32-bit VFP SoftFP ABI - 523");
		res.put(541, "Linux ARM 64-bitLinux ARM 64-bit - 541");
		res.put(214, "Linux ItaniumLinux Itanium - 214");
		res.put(525, "Linux SPARCLinux SPARC - 525");
		res.put(46, "Linux x86Linux x86 - 46");
		res.put(226, "Linux x86-64Linux x86-64 - 226");
		res.put(518, "Mediatek MTZMediatek MTZ - 518");
		res.put(912, "Microsoft Windows (32-bit)Microsoft Windows (32-bit) - 912");
		res.put(67, "Microsoft Windows CEMicrosoft Windows CE - 67");
		res.put(208, "Microsoft Windows Itanium (64-bit)Microsoft Windows Itanium (64-bit) - 208");
		res.put(539, "Microsoft Windows PhoneMicrosoft Windows Phone - 539");
		res.put(233, "Microsoft Windows x64 (64-bit)Microsoft Windows x64 (64-bit) - 233");
		res.put(536, "Net-Net 4250Net-Net 4250 - 536");
		res.put(533, "Net-Net 9200Net-Net 9200 - 533");
		res.put(547, "Netra Server X5-2 for CommunicationsNetra Server X5-2 for Communications - 547");
		res.put(535, "Netra X3-2 for Acme PacketNetra X3-2 for Acme Packet - 535");
		res.put(313, "OpenSolarisOpenSolaris - 313");
		res.put(49, "Oracle Certification EnvironmentOracle Certification Environment - 49");
		res.put(309, "Oracle JRockit Virtual Edition x86 (32-bit)Oracle JRockit Virtual Edition x86 (32-bit) - 309");
		res.put(311, "Oracle JRockit Virtual Edition x86-64 (64-bit)Oracle JRockit Virtual Edition x86-64 (64-bit) - 311");
		res.put(506, "Oracle Solaris ExpressOracle Solaris Express - 506");
		res.put(453, "Oracle Solaris on SPARC (32-bit)Oracle Solaris on SPARC (32-bit) - 453");
		res.put(23, "Oracle Solaris on SPARC (64-bit)Oracle Solaris on SPARC (64-bit) - 23");
		res.put(173, "Oracle Solaris on x86 (32-bit)Oracle Solaris on x86 (32-bit) - 173");
		res.put(267, "Oracle Solaris on x86-64 (64-bit)Oracle Solaris on x86-64 (64-bit) - 267");
		res.put(72, "Palm ComputingPalm Computing - 72");
		res.put(511, "QNX UnixQNX Unix - 511");
		res.put(514, "Qualcomm Brew MPQualcomm Brew MP - 514");
		res.put(298, "RIM BlackBerryRIM BlackBerry - 298");
		res.put(510, "SCO UnixSCO Unix - 510");
		res.put(505, "SPARCSPARC - 505");
		res.put(550, "StorageTek HardwareStorageTek Hardware - 550");
		res.put(507, "SunOSSunOS - 507");
		res.put(26, "Symbian EPOCSymbian EPOC - 26");
		res.put(532, "TekelecTekelec - 532");
		res.put(508, "Trusted SolarisTrusted Solaris - 508");
		res.put(316, "Unisys OS 2200Unisys OS 2200 - 316");
		res.put(520, "VxWorksVxWorks - 520");
		res.put(297, "iTroniTron - 297");
		res.put(299, "ia64ia64 - 299");
		res.put(280, "x86 32 bitx86 32 bit - 280");
		res.put(282, "x86 64 bitx86 64 bit - 282");
		res.put(276, "z*OBSOLETE: Monta Vista x86z*OBSOLETE: Monta Vista x86 - 276");
		res.put(277, "z*OBSOLETE: Monta Vista x86-64z*OBSOLETE: Monta Vista x86-64 - 277");
		res.put(21, "z*OBSOLETE: Novell NetWarez*OBSOLETE: Novell NetWare - 21");
		return res;
	}
	
	private static Map<String, Integer> loadString2Int() {
		Map<String, Integer> res = new HashMap<String, Integer>();
		for(Integer key : int2string.keySet()) {
			String value = int2string.get(key);
			res.put(value, key);
		}
		return res;
	}
	public static String getOSName(int osId){
		return int2string.get(osId);
	}
	public static int getOSNameId(String osName){
		return string2int.get(osName);
	}
}
